home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / shootemup / includes / plyfire.h < prev    next >
Encoding:
Text File  |  2002-04-10  |  2.7 KB  |  111 lines

  1. ;
  2. ; An entire fucking fire engine just for firing fuck it all
  3. ;
  4.  
  5.  
  6. ;Graphics 640,480
  7.  
  8. ;Global plyfire=LoadAnimImage("sprites/player/std_fire.bmp",16,16,0,7)
  9.  
  10. Global ply_bullets=50
  11. Global plyshot_speed=10
  12. Global autofire_speed=6
  13.  
  14. Global ply_blcn=0
  15. ;Global player_x=320
  16. ;Global player_y=220
  17.  
  18. Dim fwd_plybullet(128,2) 
  19. Dim bkd_plybullet(128,2) 
  20. Dim ltp_plybullet(128,2) 
  21. Dim rtp_plybullet(128,2) 
  22. Dim lsd_plybullet(128,2) 
  23. Dim rsd_plybullet(128,2)
  24.  
  25. ;While Not KeyDown(1)
  26. ;    
  27. ;    If KeyHit(157)
  28. ;        shoot_bullets()
  29. ;    EndIf
  30. ;    ; autofire
  31. ;    auto=auto+1
  32. ;    If(auto Mod autofire_speed)=0
  33. ;        shoot_bullets()
  34. ;    EndIf
  35. ;    
  36. ;    update_bullets()
  37. ;    Flip :  Cls : VWait
  38. ;
  39. ;Wend
  40.  
  41. Function shoot_bullets()
  42.  
  43.     ply_blcn=ply_blcn+1
  44.     If ply_blcn>ply_bullets-1 Then ply_blcn=1
  45.     fwd_plybullet(ply_blcn,1) = ply_x+22
  46.     fwd_plybullet(ply_blcn,2) = ply_y
  47.  
  48.     bkd_plybullet(ply_blcn,1) = ply_x+22
  49.     bkd_plybullet(ply_blcn,2) = ply_y+48
  50.  
  51.     lsd_plybullet(ply_blcn,1) = ply_x+20
  52.     lsd_plybullet(ply_blcn,2) = ply_y+20
  53.  
  54.     rsd_plybullet(ply_blcn,1) = ply_x+26
  55.     rsd_plybullet(ply_blcn,2) = ply_y+20
  56.  
  57.     ltp_plybullet(ply_blcn,1) = ply_x+20
  58.     ltp_plybullet(ply_blcn,2) = ply_y+8
  59.  
  60.     rtp_plybullet(ply_blcn,1) = ply_x+24
  61.     rtp_plybullet(ply_blcn,2) = ply_y+8
  62.  
  63.  
  64. End Function
  65.  
  66. Function update_bullets()
  67.     If ply_blcn>0
  68.  
  69.         For bul_cn=0 To ply_blcn
  70.             fwd_plybullet(bul_cn,2) = fwd_plybullet(bul_cn,2) - plyshot_speed
  71.             If fwd_plybullet(bul_cn,2)>0
  72.                 DrawImage plyfire,fwd_plybullet(bul_cn,1),fwd_plybullet(bul_cn,2),0    
  73.             EndIf 
  74.         Next
  75.  
  76.         If plygun\backward_shot=1
  77.             For bul_cn=0 To ply_blcn
  78.                 bkd_plybullet(bul_cn,2) = bkd_plybullet(bul_cn,2) + plyshot_speed
  79.                 If bkd_plybullet(bul_cn,2)>0
  80.                     DrawImage plyfire,bkd_plybullet(bul_cn,1),bkd_plybullet(bul_cn,2),1    
  81.                 EndIf 
  82.             Next
  83.         EndIf
  84.  
  85.         If plygun\side_shot=1
  86.             For bul_cn=0 To ply_blcn
  87.                 lsd_plybullet(bul_cn,1) = lsd_plybullet(bul_cn,1) - plyshot_speed
  88.                 rsd_plybullet(bul_cn,1) = rsd_plybullet(bul_cn,1) + plyshot_speed
  89.                 If lsd_plybullet(bul_cn,2)>0            
  90.                     DrawImage plyfire,lsd_plybullet(bul_cn,1),lsd_plybullet(bul_cn,2),3    
  91.                     DrawImage plyfire,rsd_plybullet(bul_cn,1),rsd_plybullet(bul_cn,2),4    
  92.                 EndIf 
  93.             Next
  94.         EndIf
  95.  
  96.         If plygun\twoway_shot=1
  97.             For bul_cn=0 To ply_blcn
  98.                 ltp_plybullet(bul_cn,1) = ltp_plybullet(bul_cn,1) - plyshot_speed
  99.                 ltp_plybullet(bul_cn,2) = ltp_plybullet(bul_cn,2) - plyshot_speed
  100.                 rtp_plybullet(bul_cn,1) = rtp_plybullet(bul_cn,1) + plyshot_speed
  101.                 rtp_plybullet(bul_cn,2) = rtp_plybullet(bul_cn,2) - plyshot_speed
  102.  
  103.                 If lsd_plybullet(bul_cn,2)>0
  104.                     DrawImage plyfire,ltp_plybullet(bul_cn,1),ltp_plybullet(bul_cn,2),5    
  105.                     DrawImage plyfire,rtp_plybullet(bul_cn,1),rtp_plybullet(bul_cn,2),6    
  106.                 EndIf
  107.             Next 
  108.         EndIf
  109.     EndIf
  110.  
  111. End Function